from threading import Thread

num = 1

def work1():
    global num
    for i in range(3):
        num += 1 + i
    print('work1输出num:',num)


def work2():
    global num
    for i in range(3):
        num += i
    print('work2输出num:',num)

if __name__ == "__main__":
    print('父进程开始运行')
    t1 = Thread(target=work1)
    t2 = Thread(target=work2)
    t1.start()
    t1.join()
    t2.start()
    t2.join()
    print('主线程的num:',num)